#ifndef __RTSP_SERVICE_H__
#define __RTSP_SERVICE_H__
#include <BasicUsageEnvironment.hh>
#include "version.hh"
#include "MediaSink.hh"
#include "liveMedia.hh"
#include "BasicUsageEnvironment.hh"
#include "GroupsockHelper.hh"
#include "FramedSource.hh"
#include "rtsp_h264liveSource.h"
#include "rtsp_h264liveSMS.h"
#include "IVidRtsp.h"

class RtspService : public IVidRtsp
{
private:
    TaskScheduler* _task_scheduler;
    UsageEnvironment* _usage_env;
    UserAuthenticationDatabase* _authDB;
    RTSPServer* _rtspServer;
    ServerMediaSession *_serverMediaSession;
    rtsp_h264liveSrouce * _videoSource;
    rtsp_h264liveSMS *_videoliveSMS;
    CRingBuffer<VidPacket> *_rtsp_ringBuffer;
    RtspConfig _rtsp_cfg;
    pthread_t _rtspLoopThread;
    static void *rtsp_loop(void *ctx);
    bool _isInit;
    bool _isStart;


public:
    RtspService(/* args */);
    ~RtspService();

    int32_t init(RtspConfig *rtsp_cfg);
    int32_t deinit();

    int32_t start();
    int32_t stop();

    int32_t deliver(VidPacket *vid_pkg );
};



#endif

